﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/include/header.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui.admin/css/style.css" />

</head>
<body style="background-color: white;">
	<div class="page-container" style="height: 500px;">
		<p class="f-20 text-success">
			欢迎使用_云算盘 <span class="f-14">v3.1</span>！
		</p>
		
		<div class="action_box m_t10 m_b10 t_l">
			<input type="button" class="a_btn" value="新增账套" id="addBtn" />
		</div>
		<table id="tbwrap" class="table table-border table-bordered table-bg"></table>
		<div class="page eui-pager-custom" id="j_pager"></div>

	</div>
	
	<script type="text/html" id="tb_template">
		<thead>
			<tr class="text-c">
				<th colspan="2" width="20%">企业（账套）名称</th>
				<th>本位币</th>
				<th>启用年份</th>
				<th>启用月份</th>
				<th>会计制度</th>
				<th>纳税人名称</th>
				<th>纳税人识别号</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody data-type="body">
			<!if(list.length>0) { !>
				<!for(var i=0,len=list.length;i<len;i++){
					var item = list[i],classItem = (i%2!=0)?"odd td_odd":"even";
				!>
				<tr class="text-c <!=classItem!>">
					<td>
						<!=item["qymc"]!>
					</td>
					<td style="border-left: 0px;">
						<a title="编辑" data-value="<!=item["uuid"]!>" class="edit" style="text-decoration: none;margin-right: 10px;">
							<i class="Hui-iconfont">&#xe6df;</i>
						</a>
						<a title="删除" data-value="<!=item["uuid"]!>" class="delete_btn" style="text-decoration: none">
							<i class="Hui-iconfont">&#xe6e2;</i>
						</a>
					</td>
					<td><!=item["bwb"]!></td>
					<td><!=item["qyYear"]!></td>
					<td><!=item["qyMonth"]!></td>
					<td><!=item["kzzd"]!></td>
					<td><!=item["nsrmc"]!></td>
					<td><!=item["nsrcbh"]!></td>
					<td>
						<a data-value="<!=item["uuid"]!>" class="detail">去做账</a>
					</td>
				</tr>
			<!}!>
			<!}else{!>
				<tr class="text-c">
					<td colspan="10"> 暂无数据</td>
				</tr>
			<!}!>
		</tbody>
	</script>
	
	<script type="text/javascript">
		var zhangTaoDialog;
		$(function() {

			// 添加
			$("#addBtn").click(function() {
				parent.member_add('新增账套', '${ctx}/zhangTao/toAdd',680,260);
			});
			
			// 详细
			$("#tbwrap").delegate(".detail", "click", function() {
				var uuid = $(this).data("value");
				var url = "${ctx}/login/toMain";
		        var form = $("<form></form>").attr("action", url).attr("method", "post").attr("target","_top");
		        form.append($("<input></input>").attr("type", "hidden").attr("name", "uuid").attr("value", uuid));
		        form.appendTo('body').submit();
			});
			
			// 编辑
			$("#tbwrap").delegate(".edit", "click", function() {
				var uuid = $(this).data("value");
				parent.member_add('修改账套信息', '${ctx}/zhangTao/toEdit?uuid='+uuid,680,260);
			});
			
			// 4、删除
			$("#tbwrap").delegate(".delete_btn", "click", function() {
				var uuid = $(this).data("value");
				if (confirm('确定删除账套？')) {
					$.post("${ctx}/zhangTao/delete", { uuid : uuid, CSRFToken : $("#CSRFToken").val()}, function(result) {
						if ("succ" == result) {
							alert("操作成功");
							// 刷新列表页面
							search(); 
						} else {
							alert(result);
						}
					}, "json");
				}
			
			});
			// 5、查询
			$("#searchBtn").click(function() {
				search();
			});
			
			// 页面加载完成调用查询分页
			search();
		});
	</script>

	<script type="text/javascript">
		function search() {
			// 这里放包含查询条件的DIV
			var paramData = easyUtils.getQueryDivDefault("queryDiv");

			seajs.use([ "component/table" ], function(uiTable) {
				var param = {
					url : "${ctx}/zhangTao/ajaxPage",
					data : paramData
				};
				easyUtils.getData(param, function(result) {
					easyUtils.buildTable(result, param, uiTable);
				});
			});
		}
	</script>

	<footer class="footer mt-20">
		<div class="container">
			<p>版权所有：潮合（海南）科技有限公司 v3.1</p>
		</div>
	</footer>
	<script type="text/javascript" src="${ctx}/static/h-ui/js/H-ui.min.js"></script>
</body>
</html>